home *** CD-ROM | disk | FTP | other *** search
- class disney.rabbitRivalry.GameState
- {
- var score;
- var misses;
- var levelNum;
- var actionState;
- var GRAVITY;
- var isYang;
- var hasChanged;
- static var __instance;
- var __MISSES_ALLOWED = 5;
- var TOTAL_LEVELS = 10;
- function GameState()
- {
- }
- static function init()
- {
- disney.rabbitRivalry.GameState.__instance = new disney.rabbitRivalry.GameState();
- }
- static function getInstance()
- {
- return disney.rabbitRivalry.GameState.__instance;
- }
- function reset()
- {
- this.score = 0;
- this.misses = 0;
- this.levelNum = 1;
- this.actionState = 1;
- this.GRAVITY = new smashing.Point3D(0,290,0);
- if(Math.random() > 0.5)
- {
- this.isYang = true;
- }
- else
- {
- this.isYang = false;
- }
- this.hasChanged = false;
- }
- function addScore(num)
- {
- this.score += num;
- smashing.keithm.Messenger.sendMessage("screen","updateScore");
- }
- function miss()
- {
- this.misses = this.misses + 1;
- }
- function removeMiss()
- {
- if(this.misses > 0)
- {
- this.misses = this.misses - 1;
- }
- else
- {
- this.addScore(250);
- }
- }
- function isGameOver()
- {
- if(this.misses >= this.__MISSES_ALLOWED)
- {
- return true;
- }
- return false;
- }
- function advanceState()
- {
- this.actionState = this.actionState + 1;
- if(this.actionState == 4)
- {
- smashing.keithm.Messenger.sendMessage("ui","disableActiveScreenUpdates");
- smashing.keithm.Messenger.sendMessage("world","enablePowerAim");
- }
- }
- function restartState()
- {
- this.actionState = 1;
- }
- function toggleRabbit()
- {
- this.restartState();
- this.isYang = !this.isYang;
- }
- }
-